Skip to content

fix: resolve plugin dependencies from data directory#39

Merged
yepzdk merged 1 commit into
mainfrom
feature/plugin-dependency-management
Apr 21, 2026
Merged

fix: resolve plugin dependencies from data directory#39
yepzdk merged 1 commit into
mainfrom
feature/plugin-dependency-management

Conversation

@yepzdk
Copy link
Copy Markdown
Collaborator

@yepzdk yepzdk commented Apr 21, 2026

Summary

  • Add SessionStart hook to plugin.json that installs npm dependencies into CLAUDE_PLUGIN_DATA (only when package.json changes)
  • Set NODE_PATH env var on the MCP server so Node resolves modules from the plugin data directory
  • Switch html2canvas path resolution from hardcoded ../node_modules/ to createRequire-based lookup, which respects NODE_PATH

Test plan

  • Install plugin in Claude Code and verify html2canvas.min.js is served correctly at /html2canvas.min.js
  • Verify widget injection works and screenshots are captured
  • Confirm SessionStart hook runs npm install on first launch and skips it on subsequent launches when package.json hasn't changed

🤖 Generated with Claude Code

… hook

The Claude plugin system installs plugins into a read-only root directory,
so npm dependencies need to be installed separately into the plugin data
directory. This adds a SessionStart hook that runs npm install into
CLAUDE_PLUGIN_DATA when package.json changes, sets NODE_PATH so Node can
find the modules, and switches html2canvas resolution to createRequire
instead of hardcoded relative paths.

Co-authored-by: Claude <noreply@anthropic.com>
@yepzdk yepzdk merged commit af41601 into main Apr 21, 2026
1 check passed
@yepzdk yepzdk deleted the feature/plugin-dependency-management branch April 21, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant